import { reducer as counterReducer } from './count';
import { reducer as homeReducer } from './home';

import { combineReducers } from 'redux';

//1.自定义函数 多个reducer合并在一起
// function reducer(state = {}, action) {
//   return {
//                 // {}里取counterInfo为undefined 就会使用上面定义的默认值
//     counterInfo: counterReducer(state.counterInfo, action),
//     homeInfo: homeReducer(state.homeInfo, action)
//   } 
// }

//2. 使用内置插件 合并
const reducer = combineReducers({
  counterInfo: counterReducer,
  homeInfo: homeReducer
})

export default reducer